<html>
<head>
</head>
<body>
<center>
	<div style='position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 50%; height: 50%; margin: auto; overflow: show;'>
		<img src='loading.png'>
		<div id='loadingtext' style='margin-top: 10px; color: #F00; font-family: Arial; font-size: 12px; font-weight: bold;'>Loading Text..</div>
	</div>
</center>
	<div style='-webkit-box-reflect: below -120px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.1, transparent), to(rgba(255, 255, 255, 1.0))); position: absolute; top: 90%; right: 0; bottom: 0; left: 5%; height: 100px; overflow: show; font-family: Arial; font-size: 24px; font-weight: bold; color: #F00' id='files'>
	</div>

<script type="text/javascript">

	keywords = 
	[
	 "Unwelding Boxes.", 
	 "Charging Toolgun.", 
	 "Breaking Addons.", 
	 "Stuffing Ragdolls.", 
	 "Unreticulating Splines.", 
	 "Refuelling Thrusters.", 
	 "Unknotting ropes.",
	 "Painting Barrels.",
	 "Feeding Birds.",
	 "Bathing Father Grigori.",
	 "Decoding Lua's syntax.",
	 "Re-killing Alyx.",
	 "Calibrating Manhacks.",
	 "Cleaning Leafblower.",
	 "Reconfiguring Gravity Matrix.",
	 "Growing Watermelons.",
	 "Mowing Grass.",
	 "Plastering Walls.",
	 "Inflating Balloons.",
	 "Taming Physics.",
	 "Calling Sleep( 1000 ); ",
	 "Unfreezing The Freeman.",
	 "Patching Broken Update.",
	 "Styling Mossman's Hair.",
	 "Reducing lifespan of Alyx.",
	 "Polishing Kliener's Head.",
	 "Delaying Episode 3.",
	 "Changing Physgun Batteries.",
	 "Breaking Source Engine"
	]


	var bCanChangeStatus = true;
	function ChangeText ( )	{
		if ( bCanChangeStatus )
		{
			var keyword = keywords[ Math.floor( Math.random() * keywords.length ) ]
			document.getElementById( "loadingtext" ).innerHTML = keyword;
		}
		
		setTimeout( "ChangeText()", 2500 );
	}
	
	ChangeText();
	
	var iFilesNeeded = 0;
	var iFilesTotal = 0;
	var bDownloadingFile = false;
	
	function SetFilesNeeded( iNeeded )
	{
		iFilesNeeded = iNeeded;
		RefreshFileBox();
	}
	
	function SetFilesTotal( iTotal )
	{
		iFilesTotal = iTotal;
		RefreshFileBox();
	}
	
	function DownloadingFile( filename )
	{
		if ( bDownloadingFile )
		{
			iFilesNeeded = iFilesNeeded - 1;
			RefreshFileBox();
		}
		
		document.getElementById( "loadingtext" ).innerHTML = "Downloading " + filename;
		bCanChangeStatus = false;
		setTimeout( "bCanChangeStatus = true;", 1000 );
		
		bDownloadingFile = true;
		
	}
	
	function SetStatusChanged( status )
	{
		if ( bDownloadingFile )
		{
			iFilesNeeded = iFilesNeeded - 1;
			bDownloadingFile = false;
			RefreshFileBox();
		}
		
		document.getElementById( "loadingtext" ).innerHTML = status;
		bCanChangeStatus = false;
		setTimeout( "bCanChangeStatus = true;", 1000 );
	}
	
	function RefreshFileBox()
	{
		document.getElementById( "files" ).innerHTML = "<img src='download.png' style='position: relative; top: 7px;'> " + iFilesNeeded + " downloads remaining";
		
		if ( iFilesTotal > 0 )
			document.getElementById( "files" ).style.visibility = 'visible';
		else
			document.getElementById( "files" ).style.visibility = 'hidden';
	}
	
	RefreshFileBox();
	
</script>

</body>
</html>